<template>

    <el-dialog title="编辑竞买人信息" :visible="bidderEditShow" @close="dialogClose" width="40%">

        <el-form :model="ruleForm" status-icon :rules="rules" ref="roleEdit" label-width="auto" class="demo-ruleForm">
            <el-form-item label="用户名：" prop="userID">
                <el-input type="text" v-model="ruleForm.userID" disabled></el-input>
            </el-form-item>
            <el-form-item label="姓名：" prop="name">
                <el-input type="text" v-model="ruleForm.name"></el-input>
            </el-form-item>
            <el-form-item label="密码：" prop="pass">
                <el-input type="text" v-model="ruleForm.pass"></el-input>
            </el-form-item>
            <el-form-item label="邮箱：" prop="email">
                <el-input type="email" v-model="ruleForm.email"></el-input>
            </el-form-item>
            <el-form-item label="联系电话：" prop="tel">
                <el-input type="text" v-model="ruleForm.tel"></el-input>
            </el-form-item>
            <el-form-item label="状态：" prop="state">
                <el-radio-group v-model="ruleForm.state">
                    <el-radio label="正常"></el-radio>
                    <el-radio label="停用"></el-radio>
                </el-radio-group>
            </el-form-item>
            <el-form-item label="角色：" prop="role">
                <el-radio-group v-model="ruleForm.role">
                    <el-radio label="角色1"></el-radio>
                    <el-radio label="角色2"></el-radio>
                </el-radio-group>
            </el-form-item>
            <el-form-item label="隶属企业ID：" prop="enterprises">
                <el-select v-model="ruleForm.enterprises" style="width:100%" clearable>
                    <el-option label="1" value="1"></el-option>
                    <el-option label="2" value="2"></el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="隶属部门ID：" prop="department">
                <el-select v-model="ruleForm.department" style="width:100%" clearable>
                    <el-option label="1" value="1"></el-option>
                    <el-option label="2" value="2"></el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="备注：" prop="remarks">
                <el-input type="textarea" :rows="4" v-model="ruleForm.remarks">
                </el-input>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="submitForm('ruleForm')" class="pull-right margin-l-25">确定
                </el-button>
                <el-button @click="dialogClose" class="pull-right">取消</el-button>
            </el-form-item>
        </el-form>
    </el-dialog>

</template>
<script>
export default {
    name: 'bidderAccountAdd',
    data () {
        return {
            ruleForm: {
                userID: '',
                name: '',
                pass: '',
                email: '',
                tel: '',
                state: '',
                role:'',
                enterprises:'',
                department:'',
                remarks:''
            },
            rules: {
                
                userID: [
                    { required: true, message: '请输入用户名', trigger: 'blur' }
                ],
                name: [
                    { required: true, message: '请输入姓名', trigger: 'blur' }
                ],
                pass: [
                    { required: true, message: '请输入密码', trigger: 'blur' }
                ],
                tel: [
                    { required: true, message: '请输入联系电话', trigger: 'blur' }
                ],
                state: [
                    { required: true, message: '请选择状态', trigger: 'change' }
                ],
                role: [
                    { required: true, message: '请选择角色', trigger: 'change' }
                ],
                
            }
        };

    },

    props: {
        bidderEditShow: {
            type: Boolean
        },
        record:{
            typeof:Object
        }
    },
    methods: {

        submitForm () {
            this.$refs.roleEdit.validate((valid) => {
                if (valid) {
                    alert('submit!');
                    this.$emit('dialogClose')
                }
                else {
                    return
                }
            });
        },

        // 重置
        // resetForm (formName) {
        //     this.$refs[formName].resetFields();
        // },
        dialogClose () {
            this.$emit('dialogClose')
            // this.liveAddShow=false
        }
    },
    mounted () {
        // console.log(this.record)
        this.ruleForm = this.record
    }
}
</script>
<!-- <style lang="less" scoped>

</style> -->